package com.kky.pp.common

import android.content.Context
import com.kky.pp.entity.BuyResultEnum
import io.rong.imkit.pay.IMPayListener

class OpenUpBuyMember : IMPayListener {

    override fun goBuyMemberPay(
        context: Context?,
        currentItem: Int,
        productCategory: Int,
        targetId: String,
        result: (() -> Unit?)?
    ) {
        context?.let { it ->
            MemberBuy().openMemberBuy(it, currentItem, productCategory,targetId, callBackListener = {
                if (it == BuyResultEnum.SUCCESS) {
                    result?.invoke()
                }
            })
        }
    }

    override fun goBuyMemberUnitaryPay(
        context: Context?,
        currentItem: Int,
        productCategory: Int,
        result: (() -> Unit?)?
    ) {
        context?.let { it ->
            MemberUnitaryBuy().openMemberUnitaryBuy(
                it,
                productCategory,
                callBackListener = {
                    if (it == BuyResultEnum.SUCCESS) {
                        result?.invoke()
                    }
                })
        }
    }
}